package Classes.Collisions 
{
	import flash.geom.Point;
	import Direction;
	/**
	 * ...
	 * @author Alex
	 */
	public class LevelCollision 
	{
		private var m_blockwidth:Number = 32;
		
		public function LevelCollision() 
		{
		}
		
		public function getCoordsAfterCollision(directionOfCollision:String,heightOfObject:int,widthOfObject:int,currentLocation:Point):Point
		{
			var height:int = heightOfObject;
			var width:int = widthOfObject;
			
			var directionMoving:String = directionOfCollision;
			var blockwidth:Number = m_blockwidth;
			var adjustLocation:Point = new Point();
			adjustLocation = currentLocation;
			
			if (directionMoving == Direction.DOWN)
			{
				//move up
				adjustLocation.y = Math.floor(adjustLocation.y / blockwidth) * blockwidth ;
			}
			if (directionMoving == Direction.UP)
			{
				//move down
				adjustLocation.y = Math.floor(adjustLocation.y / blockwidth) * blockwidth + height;
			}
			if (directionMoving == Direction.LEFT)
			{
				//move down
				adjustLocation.x = Math.floor(adjustLocation.x / blockwidth) * blockwidth + width;
			}
			if (directionMoving == Direction.RIGHT)
			{
				//move down
				adjustLocation.x = Math.floor(adjustLocation.x / blockwidth) * blockwidth;
			}
			
			return adjustLocation;
		}
	}
	
}